package com.shaoshaohuo.app.ui.ec;

import com.shaoshaohuo.app.R;
import com.shaoshaohuo.app.framework.AccountManager;
import com.shaoshaohuo.app.ui.BaseActivity;
import com.shaoshaohuo.app.ui.shipper.FindCarActivity;
import com.shaoshaohuo.app.ui.shipper.MyOrderShipperActivity;
import com.shaoshaohuo.app.ui.shipper.MyOrderTailAfterActivity;
import com.shaoshaohuo.app.ui.shipper.SendGoodsActivity;
import com.shaoshaohuo.app.view.TopbarView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * @author: yusonglin
 * @类 说 明:
 * @version 1.0
 * @创建时间：2015年8月31日 下午12:47:58
 * 
 */
public class MyLogisticsActivity extends BaseActivity implements OnClickListener {

    private TopbarView mTopbarView;

    private View mSendGoodsLayout;
    private View mFindCarLayout;
    private View mMyOrderLayout;
    private View mLogisticsLayout;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_logistics);
        initView();
        setUpView();
    }

    private void initView() {
        mTopbarView = (TopbarView) this.findViewById(R.id.topbar);

        mSendGoodsLayout = this.findViewById(R.id.layout_woyaofahuo);
        mFindCarLayout = this.findViewById(R.id.layout_woyaozhaoche);
        mMyOrderLayout = this.findViewById(R.id.layout_wodedingdan);
        mLogisticsLayout = this.findViewById(R.id.layout_wuliuchaxun);

    }

    private void setUpView() {
        mTopbarView.setCenterText("我的物流");
        mTopbarView.setLeftView(true, true);

        mSendGoodsLayout.setOnClickListener(this);
        mFindCarLayout.setOnClickListener(this);
        mMyOrderLayout.setOnClickListener(this);
        mLogisticsLayout.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.layout_woyaofahuo:
            if (AccountManager.checkUserAuth(this)) {
                startActivity(new Intent(this, SendGoodsActivity.class));
            }
            break;
        case R.id.layout_woyaozhaoche:
            if (AccountManager.checkUserAuth(this)) {
                startActivity(new Intent(this, FindCarActivity.class));
            }
            break;
        case R.id.layout_wodedingdan:
            if (AccountManager.checkLogin(this)) {
                startActivity(new Intent(this, MyOrderShipperActivity.class));
            }
            break;
        case R.id.layout_wuliuchaxun:
            if (AccountManager.checkLogin(this)) {
                startActivity(new Intent(this, MyOrderTailAfterActivity.class));
            }
            break;
        }
    }
}
